//ST*****************************************滑动框*****************************************
/*
data:{
	index: 0,
	displayCount: 5,//3, 5, 7, 9
	normal: {
		width: 100,
		height: 100
	},
	active: {
		width: 150,
		height: 150
	},
	scale: 1.5,
	images: [
		{normal:"",active:""}
	]
}
*/
function RxSlider() {
}
RxSlider.init = function(id, data, style, callback) {
	var ctrl = document.getElementById(id);
	if (!ctrl) {
		ctrl = document.createElement("div");
	}

	ctrl.ce = RxCommon.ce;
	ctrl.dispose = RxCommon.dispose;
	ctrl.dispose();
	ctrl.data = data;
	ctrl.views = [];

	if (id) {
		ctrl.id = id;
	}
	ctrl.rxtype = "RxSlider";
	ctrl.className = "rxslider";

	if (style) {
		RxCommon.setStyle(ctrl, style);
	}

	ctrl.callback = callback;

	ctrl.draw = function() {
		var self = this;
		if (self.data.views.length <= 0) {
			return;
		}
		for (var i = 0; i < self.data.views.length; i++) {
			var normal = self.ce(self, null, "img", "rxslider_ele");
			normal.src = self.data.images[i].normal;
			normal.style.width = self.data.normal.width + "px";
			normal.style.height = self.data.normal.height + "px";
			normal.index = i;
			self.appendChil(normal);

			var active = self.ce(self, null, "img", "rxslider_ele");
			active.src = self.data.images[i].active;
			active.style.width = self.data.active.width + "px";
			active.style.height = self.data.active.height + "px";
			active.index = i;
			self.appendChil(active);

			normal.onclick = function() {
				self.play(this.index);
			};
			active.onclick = function() {
				self.play(this.index);
			};

			self.views[{normal:normal, active:active}];
		}
	};
	ctrl.draw(data);

	ctrl.play = function(index) {
		
	};
	ctrl.animate = function(flag) {
		var self = this;
		var cx = $(self).width()/2;
		var cy = $(self).height()/2;
		var normal = self.views[self.data.index].normal;
		var active = self.views[self.data.index].active;
	};

	return ctrl;
}
//ED*****************************************滑动框*****************************************
